﻿using Microsoft.WindowsAzure.Storage.Auth;
using Microsoft.WindowsAzure.Storage.Table;
using Microsoft.WindowsAzure.Storage.Table.DataServices;
using POC.Azure.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace POC.Azure.Storage.Data
{
    public class AzureTableStorageServiceContext : TableServiceContext
    {
        public const string UserEntityName = "UserEntity";
        public const string RoleEntityName = "RoleEntity";
        public const string SessionStateEntityName = "SessionStateEntity";

        public AzureTableStorageServiceContext(CloudTableClient client)
            : base(client)
        {
        }

        public IQueryable<UserEntity> Users
        {
            get
            {
                return CreateQuery<UserEntity>(UserEntityName);
            }
        }

        public IQueryable<RoleEntity> Roles
        {
            get
            {
                return CreateQuery<RoleEntity>(RoleEntityName);
            }
        }

        public IQueryable<SessionStateEntity> GetSessionTable(string tableName)
        {
            return CreateQuery<SessionStateEntity>(tableName);
        }
        public IQueryable<SessionStateEntity> SessionState
        {
            get
            {
                return CreateQuery<SessionStateEntity>(SessionStateEntityName);
            }
        }

    }
}
